<?php

/**
 * Video actions.
 *
 * @package    wills
 * @subpackage Video
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class VideoActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
	  $this->area = Doctrine::getTable('Area')->findOneBySlug($request->getParameter('area'));//获得当前赛区
    $area = Doctrine::getTable('area')->findOneBySlug($request->getParameter('area'));
    $this->thefinal = $area->getVideoByCategoryQuery('总决赛')->execute();
    $this->semifinal = $area->getVideoByCategoryQuery('半决赛')->execute();
    $this->primary = $area->getVideoByCategoryQuery('预选赛')->execute();
  }

  public function executeShow(sfWebRequest $request)
  {
	  $this->area = Doctrine::getTable('Area')->findOneBySlug($request->getParameter('area'));//获得当前赛区
    $this->video = Doctrine::getTable('Video')->find(array($request->getParameter('id')));
    $this->forward404Unless($this->video);
  }
}
